/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.cinfo.siga.datos;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author alumno
 */
@Entity
@Table(name = "TIPO_PERSONAL")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TipoPersonal.findAll", query = "SELECT t FROM TipoPersonal t"),
    @NamedQuery(name = "TipoPersonal.findByTPerCod", query = "SELECT t FROM TipoPersonal t WHERE t.tPerCod = :tPerCod"),
    @NamedQuery(name = "TipoPersonal.findByTPerDesc", query = "SELECT t FROM TipoPersonal t WHERE t.tPerDesc = :tPerDesc"),
    @NamedQuery(name = "TipoPersonal.findByTPerEst", query = "SELECT t FROM TipoPersonal t WHERE t.tPerEst = :tPerEst")})
public class TipoPersonal implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "T_PER_COD")
    private Short tPerCod;
    @Column(name = "T_PER_DESC")
    private String tPerDesc;
    @Basic(optional = false)
    @Column(name = "T_PER_EST")
    private short tPerEst;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoPersonal", fetch = FetchType.LAZY)
    private List<HistTipPers> histTipPersList;

    public TipoPersonal() {
    }

    public TipoPersonal(Short tPerCod) {
        this.tPerCod = tPerCod;
    }

    public TipoPersonal(Short tPerCod, short tPerEst) {
        this.tPerCod = tPerCod;
        this.tPerEst = tPerEst;
    }

    public Short getTPerCod() {
        return tPerCod;
    }

    public void setTPerCod(Short tPerCod) {
        this.tPerCod = tPerCod;
    }

    public String getTPerDesc() {
        return tPerDesc;
    }

    public void setTPerDesc(String tPerDesc) {
        this.tPerDesc = tPerDesc;
    }

    public short getTPerEst() {
        return tPerEst;
    }

    public void setTPerEst(short tPerEst) {
        this.tPerEst = tPerEst;
    }

    @XmlTransient
    public List<HistTipPers> getHistTipPersList() {
        return histTipPersList;
    }

    public void setHistTipPersList(List<HistTipPers> histTipPersList) {
        this.histTipPersList = histTipPersList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tPerCod != null ? tPerCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoPersonal)) {
            return false;
        }
        TipoPersonal other = (TipoPersonal) object;
        if ((this.tPerCod == null && other.tPerCod != null) || (this.tPerCod != null && !this.tPerCod.equals(other.tPerCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.cinfo.siga.datos.TipoPersonal[ tPerCod=" + tPerCod + " ]";
    }
    
}
